/*
 *copyright xkshow; admin
 */
var mainPageWidth = 837;
var mainPageHeight = 490;
$(document).ready(function(){
	mainPageWidth = $(document).width()-10;
	mainPageHeight = $(document).height()-4;
	$("#adminBody").width(mainPageWidth);
	$("#adminBody").height(mainPageHeight);
});
/*select checkbox*/
function checkAll() {
	var obj = document.getElementById("checkall");
	var ids = document.getElementsByName("ids");
	for (var i = 0; i < ids.length; i++) {
	    ids[i].checked = obj.checked;
	}
}
/*text*/
function readWrite(vID, mark) {//mark:0=read;1=write
	if(mark == 0){
		$(vID).attr("readonly","readonly");
		$(vID).removeClass().addClass("field_read");
	}else{
		$(vID).removeProp("readonly");
		$(vID).removeClass().addClass("field");
	}
}
/*update*/
function updates(form,objAction) {
	var ids = document.getElementsByName("ids");
	var num = 0;
	for (var i = 0; i < ids.length; i++) {
	    if (ids[i].checked) {
	       num++;
	    }
	}
	if (num == 0) {
	    alert("Please select the item need operation!");
	    return false;
	}
	var del = confirm("Are you sure you want to perform the operation?");
	if (del) {
	    form.action.value = objAction;
	    form.submit();
	}else {
	    return false;
	}
}
function updates(form, objAction, objID, vals) {	
	$(objID).val(vals);    
    form.action.value = objAction;
    form.submit();
}

